<script type="text/javascript" charset="utf-8" src="__STATIC__/neditor/neditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="__STATIC__/neditor/neditor.all.min.js"> </script>
<script type="text/javascript" charset="utf-8" src="__STATIC__/neditor/neditor.service.js"></script>
<!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
<!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
<script type="text/javascript" charset="utf-8" src="__STATIC__/i18n/zh-cn/zh-cn.js"></script>
<script type="text/javascript" src="__STATIC__/neditor/third-party/browser-md5-file.min.js"></script>

<script>
    if ($k === undefined) var $k = {};
    /**
     * 创建editor
     * @param editorId
     * @param textareaId
     * @param editorHeight
     * @param defaultContent
     */
    $k.mkEditor = function (
        editorId,
        textareaId,
        editorHeight,
        defaultContent
    ) {
        // 初始化参数
        editorId = editorId || 'editor';
        textareaId = textareaId || 'content';
        editorHeight = editorHeight || 500;
        defaultContent = defaultContent || '';

        var textarea = $('#'+textareaId);
        textarea.hide();

        var editorHtml = document.createElement('javascript');
        $(editorHtml).attr('type', 'text/plain').attr('id', editorId).css('height', editorHeight);
        textarea.parent().append(editorHtml);

        // 编辑器
        var ue = UE.getEditor(editorId);
        ue.ready(function () {
            ue.setContent(defaultContent);
        })
        ue.addListener('contentChange', function () {
            textarea.val(ue.getContent());
        })
    }
</script>